﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nuzzle.Protocol.Messages.Connection
{
    public class IdentificationSuccessMessage : NetworkMessage
    {
        public IdentificationSuccessMessage(string nickname, bool hasRight, bool wasAleadyConnected, int accountID,
                                                byte communautyID, string secretQuestion, double subscriptionEndDate)
            : base(NetworkMessageID.IdentificationSuccessMessage)
        {
            uint loc2 = 0;
            BooleanByteWrapper.setFlag(ref loc2, 0, hasRight);
            BooleanByteWrapper.setFlag(ref loc2, 1, wasAleadyConnected);
            base.WriterBuffer.writeByte((byte)loc2);
            base.WriterBuffer.writeUTF(nickname);
            base.WriterBuffer.writeInt(accountID);
            base.WriterBuffer.writeByte(communautyID);
            base.WriterBuffer.writeUTF(secretQuestion);
            base.WriterBuffer.writeDouble(subscriptionEndDate);
        }
    }
}
